<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>美食</title>
        <link rel="stylesheet" href="../css/Index.css" type="text/css">
        <link rel="stylesheet" href="../css/foods.css" type="text/css">
    </head>
    <body>
        <div id="top">
            <img src="../image/Logo.png" class="img1">
            <div id="top-right">
                <input type="text" name="search" id="search-input" placeholder="请输入关键字">
                <div id="search">搜索</div>
            </div>
            <div class="center">
                <span style="color: blue;font-size: 80px">南</span>
                <span style="color: red;font-size: 80px">宁</span>
                <span style="color: orange;font-size: 80px">理</span>
                <span style="color: blue;font-size: 80px">工</span>
                <span style="color: #00aa00;font-size: 80px">学</span>
                <span style="color: orange;font-size: 80px">院</span>
            </div>
            <div id="top-gov">
                <a href="https://www.bwgl.cn//">南宁理工学院</a>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <a href="http://www.weather.com.cn/weather/101300501.shtml">桂林天气</a>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <a href="../testxxx.html"><div id="user3">用户</div></a>  
            </div>
        </div>
        <hr style="height:10px;border:none;border-top:10px groove rgb(14,
            143, 194);" />
        <div id="top2">
            <div id="nav">
                <ul>
                    <li><a href="../Index_hall.html">首页</a></li>
                    <li><a href="../html/History.html">学校简介</a></li>
                    <li><a href="../html/daily.html">校园日常</a></li>
                    <li><a href="../html/Foods.html">校园美食</a></li>
                    <li><a href="../html/Views.html">校园风景</a></li>
                    <li><a href="../html/Traffic.html">位置信息</a></li>
                    <li><a href="../html/News.html">新闻速递</a></li>
                    <li><a href="../html/honor.html">学校荣誉</a></li>
                    <li><a href="../html/introduction.html">学院简介</a></li>
                </ul>
            </div>
        </div>
        <hr style="height:1px;border:none;border-top:1px dashed goldenrod;"
            />
        <div id="F-center">
            <div id="leftF" style="background: url(../image/food-choutofu.jpg);
                background-size: cover;">
                <div>
                    <p class="p1">大盘鸡</p>
                    <p class="p2">
                        大盘鸡色彩鲜艳，有爽滑麻辣的鸡肉和软糯甜润的土豆，辣中有香，粗中带细，而且经济实惠，亲朋聚会食用尚佳
                    </p>
                </div>
            </div>
            <div id="leftF" style="background: url(../image/food-doujiao.jpg);
                background-size: cover;">
                <div>
                    <p class="p1">蒸饺</p>
                    <p class="p2">
                        一人一大碗蒸饺，个大皮薄，馅热热地烫在舌头上，顿时熨平了心窝。
                    </p>
                </div>
            </div>
            <div id="leftF" style="background: url(../image/food-duck.jpg);
                background-size: cover;">
                <div>
                    <p class="p1">黄面</p>
                    <p class="p2">
                        黄面是敦煌本地特有的一种面粉，经揉、撬、甩条等多道工序精心制作而成，因煮熟后略呈黄色，黄面细如龙须,长如金线,柔韧耐拉,调汤或加菜食用,香味溢口。再加上配料精致独到，蒜、醋、辣味俱全，深受同学们欢迎。
                    </p>
                </div>
            </div>
            <div id="leftF" style="background: url(../image/food-ggtofu.jpg);
                background-size: cover;">
                <div>
                    <p class="p1">饺子</p>
                    <p class="p2">
                        “好吃不如饺子。”元宝似的饺子让人看着喜庆，吃着舒坦，是北方常见的家常饭。有传说称最早的饺子是张仲景的“祛寒娇耳汤”，是用羊肉和上辣椒做的，专治冻耳症，所以叫做“娇耳”，日久天长传成了“饺子”
                    </p>
                </div>
            </div>
            <div id="leftF" style="background: url(../image/food-mijiao.jpg);
                background-size: cover;">
                <div>
                    <p class="p1">锅包肉</p>
                    <p class="p2">
                        食时一边吃饼，一边吃肉。因这种食品兼有主食和菜肴的功能，所以不用另加主食即可饱腹。加之其味浓郁醇香，所以深受食者喜爱。
                    </p>
                </div>
            </div>
            <div id="leftF" style="background: url(../image/food-subin.jpg);
                background-size: cover;">
                <div>
                    <p class="p1">锅巴虾仁</p>
                    <p class="p2">
                        锅巴虾仁,一道两种食材差之千里的结合。锅巴脆脆的,因为有了虾仁和酸甜汁的加入,使得锅巴外软内脆,肥嫩的虾仁,被酸甜汁包裹着,
                    </p>
                </div>
            </div>

        
        </div>
        <div id="bottom">
            Copyright © 2021级通信工程一班 生俊甫 21090126. All rights reserved.&nbsp;&nbsp;
            <a href="../html/contactUs.html">联系我们</a>
            <a href="#top">回到顶部</a>
        </div>
    </body>
    <script src="../js/jquery.min.js"></script>
    <script>
        // 获取搜索输入框、搜索按钮和搜索结果的引用
    const searchInput = document.getElementById('search-input');
    const searchButton = document.getElementById('search');
    const searchResults = document.getElementById('search-results');
    const centerContent = document.getElementById('F-center').textContent.toLowerCase();
    // 创建函数来执行搜索并显示结果在新页面
    function performSearch() {
        const searchTerm = searchInput.value.toLowerCase();

        if (centerContent.includes(searchTerm)) {
            window.location.href = `search-results.html?term=${searchTerm}`;
        } else {
            window.location.href = `search-results.html`;
        }
    }
    // 添加事件监听器，以便在搜索按钮点击时执行搜索
    searchButton.addEventListener('click', performSearch);
    function get_user_info() {
        $.ajax({
            url: "/info",
            type: "get",
            success: function (res) {
                // var info_html = "<p>" + "用户:" + res.username + "</p>";
                var info_html = "用户:" + res.username;
                var screen_div = document.getElementById("user3")
                screen_div.innerHTML = info_html;
                ws_hdl = new WebSocket(ws_url);
                ws_hdl.onopen = ws_onopen;
                ws_hdl.onclose = ws_onclose;
                ws_hdl.onerror = ws_onerror;
                ws_hdl.onmessage = ws_onmessage;
            },
            error: function (xhr) {
                alert(JSON.stringify(xhr));
                location.replace("/login.html");
            }
        })
    }
    function ws_onopen() {
        console.log("websocket onopen");
    }
    function ws_onclose() {
        console.log("websocket onopen");
    }
    function ws_onerror() {
        console.log("websocket onopen");
    }
    function ws_onmessage(evt) {
        var rsp_json = JSON.parse(evt.data);
        if (rsp_json.result == false) {
            alert(evt.data);
            location.replace("/login.html");
            return;
        }
        if (rsp_json["optype"] == "hall_ready") { 
            alert("以为您跳转到校园门户！");
        } else {
            alert(evt.data);
            location.replace("/login.html");
            return;
        }
    }
    get_user_info();
    </script>
</html>